# Copyright (c) 2023 Shihao Ma, Haotian Cui, WangLab @ U of T

R2_to_type = {
    "C01": "2A",
    "C02": "2A",
    "C03": "2A",
    "C04": "2B",
    "C05": "2A",
    "C06": "2A",
    "C08": "2C",
    "C09": "2C",
    "C10": "2C",
    "C11": "2I",  # 2C or 2I
    "C12": "2C",
    "C13": "2D",
    "C14": "2C",
    "C15": "2E",
    "C16": "2F",
    "C17": "2C",
    "C18": "2C",
    "C19": "2C",
    "C20": "2G",
    "C21": "2H",
    "C22": "2C",
    "C23": "2C",
    "C24": "2C",
    "C25": "2I",  # 2C or 2I
    "C26": "2C",
    "C27": "2D",
    "C28": "2C",
    "C29": "2E",
    "C30": "2F",
    "C31": "2C",
    "C32": "2C",
    "C33": "2C",
    "C34": "2G",
    "C35": "2H",
    "C36": "2C",
    "C37": "2C",
    "C38": "2C",
    "C39": "2I",  # 2C or 2I
    "C40": "2C",
    "C41": "2D",
    "C42": "2C",
    "C43": "2E",
    "C44": "2F",
    "C45": "2C",
    "C46": "2C",
    "C47": "2C",
    "C48": "2G",
    "C49": "2H",
    "C50": "2C",
    "C51": "2C",
    "C52": "2C",
    "C53": "2I",  # 2C or 2I
    "C54": "2C",
    "C55": "2D",
    "C56": "2C",
    "C57": "2E",
    "C58": "2F",
    "C59": "2C",
    "C60": "2C",
    "C61": "2C",
    "C62": "2G",
    "C63": "2H",
}

R3_to_type = {
    "CN1": "3A",
    "CN2": "3A",
    "CN3": "3A",
    "CN4": "3A",
    "CN5": "3A",
    "CN6": "3A",
    "CN7": "3A",
    "CN8": "3A",
    "CN10": "3B",
    "1392": "3B",
}

R2_to_chain_length = {
    "C01": 16,
    "C02": 17,
    "C03": 18,
    "C04": 18,
    "C05": 20,
    "C06": 22,
    "C08": 11,
    "C09": 12,
    "C10": 13,
    "C11": 13,  # 2C or 2I
    "C12": 14,
    "C13": 14,
    "C14": 15,
    "C15": 15,
    "C16": 15,
    "C17": 16,
    "C18": 20,
    "C19": 22,
    "C20": 22,
    "C21": 22,
    "C22": 12,
    "C23": 13,
    "C24": 14,
    "C25": 14,  # 2C or 2I
    "C26": 15,
    "C27": 15,
    "C28": 16,
    "C29": 16,
    "C30": 16,
    "C31": 17,
    "C32": 21,
    "C33": 23,
    "C34": 23,
    "C35": 23,
    "C36": 14,
    "C37": 15,
    "C38": 16,
    "C39": 16,  # 2C or 2I
    "C40": 17,
    "C41": 17,
    "C42": 18,
    "C43": 18,
    "C44": 18,
    "C45": 19,
    "C46": 23,
    "C47": 25,
    "C48": 25,
    "C49": 25,
    "C50": 16,
    "C51": 17,
    "C52": 18,
    "C53": 18,  # 2C or 2I
    "C54": 19,
    "C55": 19,
    "C56": 20,
    "C57": 20,
    "C58": 20,
    "C59": 21,
    "C60": 25,
    "C61": 27,
    "C62": 27,
    "C63": 27,
}

R2_to_chain_carbons = {
    "C01": 16,
    "C02": 17,
    "C03": 18,
    "C04": 18,
    "C05": 20,
    "C06": 22,
    "C08": 10,
    "C09": 11,
    "C10": 12,
    "C11": 12,  # 2C or 2I
    "C12": 13,
    "C13": 13,
    "C14": 14,
    "C15": 14,
    "C16": 14,
    "C17": 15,
    "C18": 19,
    "C19": 21,
    "C20": 21,
    "C21": 21,
    "C22": 11,
    "C23": 12,
    "C24": 13,
    "C25": 13,  # 2C or 2I
    "C26": 14,
    "C27": 14,
    "C28": 15,
    "C29": 15,
    "C30": 15,
    "C31": 16,
    "C32": 20,
    "C33": 22,
    "C34": 22,
    "C35": 22,
    "C36": 13,
    "C37": 14,
    "C38": 15,
    "C39": 15,  # 2C or 2I
    "C40": 16,
    "C41": 16,
    "C42": 17,
    "C43": 17,
    "C44": 17,
    "C45": 18,
    "C46": 22,
    "C47": 24,
    "C48": 24,
    "C49": 24,
    "C50": 15,
    "C51": 16,
    "C52": 17,
    "C53": 17,  # 2C or 2I
    "C54": 18,
    "C55": 18,
    "C56": 19,
    "C57": 19,
    "C58": 19,
    "C59": 20,
    "C60": 24,
    "C61": 26,
    "C62": 26,
    "C63": 26,
}

R3_to_chain_length = {
    "CN1": 12,
    "CN2": 13,
    "CN3": 14,
    "CN4": 15,
    "CN5": 16,
    "CN6": 17,
    "CN7": 18,
    "CN8": 19,
    "CN10": 18,
    "1392": 18,  # CN10 is 1392 as well?
}

R3_to_chain_carbons = {
    "CN1": 12,
    "CN2": 13,
    "CN3": 14,
    "CN4": 15,
    "CN5": 16,
    "CN6": 17,
    "CN7": 18,
    "CN8": 19,
    "CN10": 18,
    "1392": 18,  # CN10 is 1392 as well?
}


def get_type(row):
    return R2_to_type[row["R2"]] + R3_to_type[row["R3"]]
